home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / communic / twntlkdm.zip / TWINHST.TWK < prev    next >
Text File  |  1990-05-23  |  8KB  |  261 lines

  1. -- USRobotics.twk - Version 1.0 du 30/01/1989
  2. -- USRobotics HST setup script for TWinTalk
  3. -- Translated to TWinPas By Jean-Michel COHEN 
  4. -- Based on Dan More Script
  5.  
  6. {$l-}  -- no listing
  7. {$d-}  -- no cross refs
  8. {$s=0} -- no extra stack alloc
  9.  
  10. Program USROBOTICS;
  11. Const
  12.     MAXTIM = 30;
  13.     NOTFOUND = 'String not found...';
  14.  
  15. Type
  16.     String = Array[1..40] Of Char;
  17.  
  18. Var
  19.     i:Integer;
  20.     c:Char;
  21.  
  22.     Procedure WaitFor(str:String);
  23.     Var Times, Result:integer;
  24.     Begin
  25.         Watch(str, 1);
  26.         Times := 0;
  27.         Result := 0;
  28.         While (Found = 0) and (Times <= MAXTIM) do
  29.         Begin
  30.             Times := Succ(Times);
  31.             Wait(1);
  32.         End;
  33.  
  34.         if Times > MAXTIM Then
  35.         Begin
  36.             WriteLn(NOTFOUND);
  37.             Exit
  38.         End
  39.     End;
  40.  
  41.     Function IsHst:Integer;
  42.     Var Times, Result: Integer;
  43.     Begin
  44.         Watch('961', 1);
  45.         Watch('963', 2);
  46.         Watch('964', 3);
  47.         Send('ATI0', RETURN);
  48.         WatchFree(0);
  49.  
  50.         Times := 0;
  51.         Result := 0;
  52.  
  53.         While (Result = 0) and (Times <= MAXTIM) Do
  54.         Begin
  55.             Wait(1);
  56.             Times := Succ(Times);
  57.             Result := Found;
  58.         End;
  59.  
  60.         IsHst := Result;
  61.     End;
  62.  
  63.     Procedure SlowSetup;
  64.     Begin
  65.         Move(16, 52, 74, 21);
  66.         Cls;
  67.         WriteLn('Starting Slow Setup...');
  68.         WriteLn;
  69.         WriteLn('SET Transmitter enabled : ATC1');
  70.         Send('ATC1', RETURN);
  71.         WaitFor('OK');
  72.         WriteLn('SET Command mode echo OFF: ATE0');
  73.         Send('ATE0', RETURN);
  74.         WaitFor('OK');
  75.         WriteLn('SET Local echo OFF after CONNECT: ATF1');
  76.         Send('ATF1', RETURN);
  77.         WaitFor('OK');
  78.         WriteLn('SET speaker ON until carrier established: ATM1');
  79.         Send('ATM1', RETURN);
  80.         WaitFor('OK');
  81.         WriteLn('SET quiet mode OFF - RESULT codes displayed: ATQ0');
  82.         Send('ATQ0', RETURN);
  83.         WaitFor('OK');
  84.         WriteLn('SET Results to verbal mode: ATV1');
  85.         Send('ATV1', RETURN);
  86.         WaitFor('OK');
  87.         WriteLn('SET Extended result code option: ATX7');
  88.         Send('ATX7', RETURN);
  89.         WaitFor('OK');
  90.         WriteLn('SET U.S. answer sequence default: ATB1');
  91.         Send('ATB1', RETURN);
  92.         WaitFor('OK');
  93.         WriteLn('Extended function - Enable ARQ result code: AT&A1');
  94.         Send('AT&A1', RETURN);
  95.         WaitFor('OK');
  96.         WriteLn('Extended function - Fix DTE rate: AT&B1');
  97.         Send('AT&B1', RETURN);
  98.         WaitFor('OK');
  99.         WriteLn('No Guard Tone (US/Canada): AT&G0');
  100.         Send('AT&G0', RETURN);
  101.         WaitFor('OK');
  102.         WriteLn('Extended function - Xmit data CTS hardware flow control: AT&H1');
  103.         Send('AT&H1', RETURN);
  104.         WaitFor('OK');
  105.         WriteLn('Extended function - rcv data flow control disabled: AT&I0');
  106.         Send('AT&I0', RETURN);
  107.         WaitFor('OK');
  108.         WriteLn('Extended function - Error control mode NORMAL/ARQ: AT&M4');
  109.         Send('AT&M4', RETURN);
  110.         WaitFor('OK');
  111.         WriteLn('Extended function - Data rate set to normal link operations: AT&N0');
  112.         Send('AT&N0', RETURN);
  113.         WaitFor('OK');
  114.         WriteLn('Extended function - Set pulse dial MAKE/BREAK ratio to U.S.: AT&P0');
  115.         Send('AT&P0', RETURN);
  116.         WaitFor('OK');
  117.         WriteLn('Extended function - Rcv data flow control->pass on RTS high: AT&R2');
  118.         Send('AT&R2', RETURN);
  119.         WaitFor('OK');
  120.         WriteLn('Extended function - Modem controls data set ready line: AT&S1');
  121.         Send('AT&S1', RETURN);
  122.         WaitFor('OK');
  123.         WriteLn('Extended function - Send destructive, expedited BREAKS: AT&Y1');
  124.         Send('AT&Y1', RETURN);
  125.         WaitFor('OK');
  126.         WriteLn('S-Register - Disable auto answer: ATS0=0');
  127.         Send('ATS0=0', RETURN);
  128.         WaitFor('OK');
  129.         WriteLn('S-Register - Reset incoming ring count to zero: ATS1=0');
  130.         Send('ATS1=0', RETURN);
  131.         WaitFor('OK');
  132.         WriteLn('S-Register - Set ASCII escape code default to ''+'': ATS2=43');
  133.         Send('ATS2=43', RETURN);
  134.         WaitFor('OK');
  135.         WriteLn('S-Register - Set ASCII carriage return to 13: ATS3=13');
  136.         Send('ATS3=13', RETURN);
  137.         WaitFor('OK');
  138.         WriteLn('S-Register - Set ASCII line feed to 10: ATS4=10');
  139.         Send('ATS4=10', RETURN);
  140.         WaitFor('OK');
  141.         WriteLn('S-Register - Set ASCII backspace to 8: ATS5=8');
  142.         Send('ATS5=8', RETURN);
  143.         WaitFor('OK');
  144.         WriteLn('S-Register - Set #seconds modem waits before dialing to 2: ATS6=2');
  145.         Send('ATS6=2', RETURN);
  146.         WaitFor('OK');
  147.         WriteLn('S-Register - Set #seconds modem waits for carrier to 45: ATS7=45');
  148.         Send('ATS7=45', RETURN);
  149.         WaitFor('OK');
  150.         WriteLn('S-Register - Set duration of pause (,) to 2/10th second: ATS8=2');
  151.         Send('ATS8=2', RETURN);
  152.         WaitFor('OK');
  153.         WriteLn('S-Register - Required duration of remote carrier 6/10TH sec: ATS9=6');
  154.         Send('ATS9=6', RETURN);
  155.         WaitFor('OK');
  156.         WriteLn('S-Register - Hang up 5 sec after loss of carrier: ATS10=50');
  157.         Send('ATS10=50', RETURN);
  158.         WaitFor('OK');
  159.         WriteLn('S-Register - Touch-Tone duration and spacing is 70 millisecs: ATS11=70');
  160.         Send('ATS11=70', RETURN);
  161.         WaitFor('OK');
  162.         WriteLn('S-Register - Escape code sequence guard time is 50 millisecs: ATS12=50');
  163.         Send('ATS12=50', RETURN);
  164.         WaitFor('OK');
  165.         WriteLn('S-Register - Set bit-mapped register to zero: ATS13=0');
  166.         Send('ATS13=0', RETURN);
  167.         WaitFor('OK');
  168.         WriteLn('S-Register - Set self-test register to data mode (NO TEST): ATS16=0');
  169.         Send('ATS16=0', RETURN);
  170.         WaitFor('OK');
  171.         WriteLn('S-Register - Set ARQ link disconnect reason register to zero: ATS17=0');
  172.         Send('ATS17=0', RETURN);
  173.         WaitFor('OK');
  174.         WriteLn('S-Register - Set inactivity timer to zero (NO AUTO HANGUP): ATS19=0');
  175.         Send('ATS19=0', RETURN);
  176.         WaitFor('OK');
  177.         WriteLn('S-Register - Set no carrier reason code register to zero: ATS20=0');
  178.         Send('ATS20=0', RETURN);
  179.         WaitFor('OK');
  180.         WriteLn('S-Register - Set length of BREAKS to 100 milliseconds: ATS21=10');
  181.         Send('ATS21=10', RETURN);
  182.         WaitFor('OK');
  183.         WriteLn('S-Register - Set ASCII value of XON to 17: ATS22=17');
  184.         Send('ATS22=17', RETURN);
  185.         WaitFor('OK');
  186.         WriteLn('S-Register - Set ASCII value of XOFF to 19: ATS23=19');
  187.         Send('ATS23=19', RETURN);
  188.         WaitFor('OK');
  189.     End;
  190.  
  191.     Procedure FastSetup;
  192.     Begin
  193.         Cls;
  194.         WriteLn('Starting Fast Setup...');
  195.         WriteLn;
  196.         Send('AT C1 E0 F1 M1 Q0 V1 X7 B1', RETURN);
  197.         WaitFor('OK');
  198.         Send('AT &A1 &B1 &G0 &H1 &I0', RETURN);
  199.         WaitFor('OK');
  200.         Send('AT &M4 &N0 &P0 &R2 &S1 &Y1', RETURN);
  201.         WaitFor('OK');
  202.         Send('AT S0=0 S1=0 S2=43 S3=13', RETURN);
  203.         WaitFor('OK');
  204.         Send('AT S4=10 S5=8 S6=2 S7=45 S8=2', RETURN);
  205.         WaitFor('OK');
  206.         Send('AT S9=6 S10=50 S11=70 S12=50', RETURN);
  207.         WaitFor('OK');
  208.         Send('AT S13=0 S16=0 S17=0', RETURN);
  209.         WaitFor('OK');
  210.         Send('AT S19=0 S20=0 S21=10 S22=17 S23=19', RETURN);
  211.         WaitFor('OK');
  212.     End;
  213.  
  214. Begin
  215.     Cls;
  216.     Caption('USRobotics Setup');
  217.  
  218.     Move(344, 52, 32, 17);
  219.  
  220.     WriteLn('USRobotics modem setup...');
  221.     WriteLn;
  222.     WriteLn('0) Exit');
  223.     WriteLn;
  224.     WriteLn('1) Fast modem setup');
  225.     WriteLn('2) Slow modem setup');
  226.     WriteLn('3) Copy settings to NRAM');
  227.  
  228.     Show;
  229.  
  230.     Repeat
  231.      ReadLn(i);
  232.     Until (i >= 0) and (i <= 3);
  233.  
  234.     if (i = 0) Then Exit(1);
  235.  
  236.     Connect;
  237.  
  238.     if IsHST = 0 Then
  239.     Begin
  240.         WriteLn('Bad luck, your modem is not a USRobotics !');
  241.         Exit;
  242.     End
  243.     Else
  244.         Case i Of
  245.             1: FastSetup;
  246.             2: SlowSetup;
  247.             3: Send('AT&W');
  248.         End;
  249.  
  250.     if (i # 3) Then
  251.     Begin
  252.         WriteLn;
  253.         WriteLn('Copy settings to NRAM ? (y/n)');
  254.         ReadLn(c);
  255.         if (c = 'y') or (c = 'Y') Then Send('AT&W');
  256.     End;
  257.  
  258.     Disconnect;
  259.     Exit(1);
  260. End.
  261.